package com

import org.apache.spark.sql.SparkSession


object CreateDataFrame {
  def main(args: Array[String]): Unit = {

    val sparkSession = SparkSession.builder()
      .appName("CreateDataFrame")
      .master("local[2]")
      .getOrCreate()

    val dataFrame = sparkSession.read.json("D:\\Downloads\\users.json")
    dataFrame.createOrReplaceTempView("user")
    dataFrame.cache()

    sparkSession.sql("select * from user").show()

    sparkSession.stop()


  }

}
